3.15 \(\int \frac{\sec (x)}{a+b \cot (x)} \, dx\)

Optimal. Leaf size=47 \[ \frac{b \tanh ^{-1}\left (\frac{a \cos (x)-b \sin (x)}{\sqrt{a^2+b^2}}\right )}{a \sqrt{a^2+b^2}}+\frac{\tanh ^{-1}(\sin (x))}{a} \]

[Out]

ArcTanh[Sin[x]]/a + (b*ArcTanh[(a*Cos[x] - b*Sin[x])/Sqrt[a^2 + b^2]])/(a*Sqrt[a^2 + b^2])

________________________________________________________________________________________

Rubi [A]  time = 0.113974, antiderivative size = 47, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 5, integrand size = 11, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.454, Rules used = {3518, 3110, 3770, 3074, 206} \[ \frac{b \tanh ^{-1}\left (\frac{a \cos (x)-b \sin (x)}{\sqrt{a^2+b^2}}\right )}{a \sqrt{a^2+b^2}}+\frac{\tanh ^{-1}(\sin (x))}{a} \]

Antiderivative was successfully verified.

[In]

Int[Sec[x]/(a + b*Cot[x]),x]

[Out]

ArcTanh[Sin[x]]/a + (b*ArcTanh[(a*Cos[x] - b*Sin[x])/Sqrt[a^2 + b^2]])/(a*Sqrt[a^2 + b^2])

Rule 3518

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[(Sin[e + f*x]
^m*(a*Cos[e + f*x] + b*Sin[e + f*x])^n)/Cos[e + f*x]^n, x] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] &&
 ILtQ[n, 0] && ((LtQ[m, 5] && GtQ[n, -4]) || (EqQ[m, 5] && EqQ[n, -1]))

Rule 3110

Int[(cos[(c_.) + (d_.)*(x_)]^(m_.)*sin[(c_.) + (d_.)*(x_)]^(n_.))/(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(
c_.) + (d_.)*(x_)]), x_Symbol] :> Int[ExpandTrig[(cos[c + d*x]^m*sin[c + d*x]^n)/(a*cos[c + d*x] + b*sin[c + d
*x]), x], x] /; FreeQ[{a, b, c, d, m, n}, x] && IntegersQ[m, n]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3074

Int[(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> -Dist[d^(-1), Subst[Int
[1/(a^2 + b^2 - x^2), x], x, b*Cos[c + d*x] - a*Sin[c + d*x]], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2,
0]

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{\sec (x)}{a+b \cot (x)} \, dx &=-\int \frac{\tan (x)}{-b \cos (x)-a \sin (x)} \, dx\\ &=-\int \left (-\frac{\sec (x)}{a}+\frac{b}{a (b \cos (x)+a \sin (x))}\right ) \, dx\\ &=\frac{\int \sec (x) \, dx}{a}-\frac{b \int \frac{1}{b \cos (x)+a \sin (x)} \, dx}{a}\\ &=\frac{\tanh ^{-1}(\sin (x))}{a}+\frac{b \operatorname{Subst}\left (\int \frac{1}{a^2+b^2-x^2} \, dx,x,a \cos (x)-b \sin (x)\right )}{a}\\ &=\frac{\tanh ^{-1}(\sin (x))}{a}+\frac{b \tanh ^{-1}\left (\frac{a \cos (x)-b \sin (x)}{\sqrt{a^2+b^2}}\right )}{a \sqrt{a^2+b^2}}\\ \end{align*}

Mathematica [A]  time = 0.0893966, size = 76, normalized size = 1.62 \[ \frac{-\frac{2 b \tanh ^{-1}\left (\frac{b \tan \left (\frac{x}{2}\right )-a}{\sqrt{a^2+b^2}}\right )}{\sqrt{a^2+b^2}}-\log \left (\cos \left (\frac{x}{2}\right )-\sin \left (\frac{x}{2}\right )\right )+\log \left (\sin \left (\frac{x}{2}\right )+\cos \left (\frac{x}{2}\right )\right )}{a} \]

Antiderivative was successfully verified.

[In]

Integrate[Sec[x]/(a + b*Cot[x]),x]

[Out]

((-2*b*ArcTanh[(-a + b*Tan[x/2])/Sqrt[a^2 + b^2]])/Sqrt[a^2 + b^2] - Log[Cos[x/2] - Sin[x/2]] + Log[Cos[x/2] +
 Sin[x/2]])/a

________________________________________________________________________________________

Maple [A]  time = 0.039, size = 63, normalized size = 1.3 \begin{align*}{\frac{1}{a}\ln \left ( \tan \left ({\frac{x}{2}} \right ) +1 \right ) }-{\frac{1}{a}\ln \left ( \tan \left ({\frac{x}{2}} \right ) -1 \right ) }-2\,{\frac{b}{a\sqrt{{a}^{2}+{b}^{2}}}{\it Artanh} \left ( 1/2\,{\frac{2\,b\tan \left ( x/2 \right ) -2\,a}{\sqrt{{a}^{2}+{b}^{2}}}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(x)/(a+b*cot(x)),x)

[Out]

1/a*ln(tan(1/2*x)+1)-1/a*ln(tan(1/2*x)-1)-2*b/a/(a^2+b^2)^(1/2)*arctanh(1/2*(2*b*tan(1/2*x)-2*a)/(a^2+b^2)^(1/
2))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)/(a+b*cot(x)),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [B]  time = 2.21523, size = 347, normalized size = 7.38 \begin{align*} \frac{\sqrt{a^{2} + b^{2}} b \log \left (\frac{2 \, a b \cos \left (x\right ) \sin \left (x\right ) -{\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - a^{2} - 2 \, b^{2} - 2 \, \sqrt{a^{2} + b^{2}}{\left (a \cos \left (x\right ) - b \sin \left (x\right )\right )}}{2 \, a b \cos \left (x\right ) \sin \left (x\right ) -{\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + a^{2}}\right ) +{\left (a^{2} + b^{2}\right )} \log \left (\sin \left (x\right ) + 1\right ) -{\left (a^{2} + b^{2}\right )} \log \left (-\sin \left (x\right ) + 1\right )}{2 \,{\left (a^{3} + a b^{2}\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)/(a+b*cot(x)),x, algorithm="fricas")

[Out]

1/2*(sqrt(a^2 + b^2)*b*log((2*a*b*cos(x)*sin(x) - (a^2 - b^2)*cos(x)^2 - a^2 - 2*b^2 - 2*sqrt(a^2 + b^2)*(a*co
s(x) - b*sin(x)))/(2*a*b*cos(x)*sin(x) - (a^2 - b^2)*cos(x)^2 + a^2)) + (a^2 + b^2)*log(sin(x) + 1) - (a^2 + b
^2)*log(-sin(x) + 1))/(a^3 + a*b^2)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\sec{\left (x \right )}}{a + b \cot{\left (x \right )}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)/(a+b*cot(x)),x)

[Out]

Integral(sec(x)/(a + b*cot(x)), x)

________________________________________________________________________________________

Giac [B]  time = 1.39786, size = 122, normalized size = 2.6 \begin{align*} \frac{b \log \left (\frac{{\left | 2 \, b \tan \left (\frac{1}{2} \, x\right ) - 2 \, a - 2 \, \sqrt{a^{2} + b^{2}} \right |}}{{\left | 2 \, b \tan \left (\frac{1}{2} \, x\right ) - 2 \, a + 2 \, \sqrt{a^{2} + b^{2}} \right |}}\right )}{\sqrt{a^{2} + b^{2}} a} + \frac{\log \left ({\left | \tan \left (\frac{1}{2} \, x\right ) + 1 \right |}\right )}{a} - \frac{\log \left ({\left | \tan \left (\frac{1}{2} \, x\right ) - 1 \right |}\right )}{a} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)/(a+b*cot(x)),x, algorithm="giac")

[Out]

b*log(abs(2*b*tan(1/2*x) - 2*a - 2*sqrt(a^2 + b^2))/abs(2*b*tan(1/2*x) - 2*a + 2*sqrt(a^2 + b^2)))/(sqrt(a^2 +
 b^2)*a) + log(abs(tan(1/2*x) + 1))/a - log(abs(tan(1/2*x) - 1))/a